package com.yan.oss.controller;

import com.yan.commonutils.R;

import com.yan.oss.service.OssService;
import io.swagger.annotations.Api;


import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@Api(tags="阿里云文件管理")

@CrossOrigin //跨域
@RestController
@RequestMapping("/eduoss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;
//    上传头像的方法
@ApiOperation(value="上传头像的方法")
    @PostMapping("upload")
    public R UploadOssFile(MultipartFile file){

        String url=ossService.upLoadFileAvatar(file);
        return R.ok().data("url",url);

    }
}
